home *** CD-ROM | disk | FTP | other *** search
/ CD Exchange / CD Exchange - Volume 1.iso / graphics / utils / videotracker / develop / sourceaga / stars.s < prev    next >
Text File  |  1994-01-21  |  43KB  |  1,925 lines

  1.  
  2. ;rout            ;when this is off, the routine-file will be
  3.             ;assembled, on=testing
  4.             
  5. ;debug            ;when this is on, colors in the background will
  6.             ;show how much time the routine needs.
  7.  
  8. ;ntsctest        ;when this is on, the routineplayer is in ntsc-mode
  9.  
  10. ;ocs            ;off=AGA,on=OCS testing not possible on OCS !
  11.  
  12. routinemode    equ    2        ;the routinemode !
  13.  
  14.  
  15. ; VideoTracker AGA developer source 25-12-93
  16. ; 24-bits colors, Super-HiRes, HAM8, maximum burstmode (64 pixels aligned)
  17. ; wich makes low-resolution overscan a bit ugly.
  18. ; no "interactive" support anymore, it's only used by Kick 1.3 users.
  19.  
  20. ; the first part of the source handles the things that are necessary to
  21. ; show the picture/copper and playing of the routine.
  22. ; the part between the "***" lines is the routine-source.
  23. ; at the bottom of the file, there are the necessary incbin-files who
  24. ; are needed to test the routine.
  25. ; these are saved with "save effect" in videotracker. they are raw
  26. ; data files which can be fonts,pictures,landscapes,vectorobjects
  27. ; etcetra.
  28. ; the incbin-files are put in the "variables" table, in the routine
  29. ; player-handler
  30. ; the place where it's done can be found by searching for "!!!"
  31.  
  32.     opt    a+    ;devpac 3 optimize
  33.     opt    o+
  34.  
  35. vew_wid    equ    48
  36. vew_hgt    equ    290
  37. win_hgt    equ    117
  38. win_str    equ    $1a
  39.  
  40.         ifd    ocs
  41. pic_wid        equ    4        ;wide in bytes
  42. pic_hgt        equ    6        ;hoogte
  43. pic_dpt        equ    8        ;number planes
  44. pic_ani        equ    10        ;aantal effes (anim)
  45. pic_vew        equ    12        ;viewmode
  46. pic_cycstr    equ    14        ;cycle start (*4)
  47. pic_cycend    equ    15        ;cycle end (*4)
  48. pic_cycspd    equ    16        ;cycle speed (*4)
  49. pic_cycadd    equ    17        ;cycle add (*4)
  50. pic_palnum    equ    30        ;aantal kleuren
  51. pic_pal        equ    32        ;palette start
  52. pic_palsiz    equ    256*2        ;vaste palette size
  53. pic_raw        equ    pic_pal+pic_palsiz    ;palette start
  54.         endc
  55.         
  56.         ifnd    ocs
  57. pic_wid        equ    4        ;wide in bytes
  58. pic_hgt        equ    6        ;hoogte
  59. pic_dpt        equ    8        ;number planes
  60. pic_ani        equ    10        ;aantal effes (anim)
  61. pic_vew        equ    12        ;viewmode
  62. pic_cycstr    equ    14        ;cycle start (*8)
  63. pic_cycend    equ    15        ;cycle end (*8)
  64. pic_cycspd    equ    16        ;cycle speed (*8)
  65. pic_cycadd    equ    17        ;cycle add (*8)
  66. pic_widmod    equ    46        ;animation-width modulo
  67. pic_future    equ    50        ;free future space
  68. pic_palnum    equ    62        ;aantal kleuren
  69. pic_pal        equ    64        ;palette start
  70. pic_palsiz    equ    256*4        ;vaste palette size (longwords)
  71. pic_raw        equ    pic_pal+pic_palsiz    ;palette start
  72.         endc
  73.         
  74. fon_hgt        equ    4            ;font hoogte
  75. fon_wid        equ    8            ;plane breedte in bytes
  76. fon_dpt        equ    12            ;depth
  77. fon_chrf    equ    16            ;eerste character
  78. fon_chrl    equ    20            ;laatste character
  79. fon_widtab    equ    24            ;font breedte per char
  80. fon_rawpos    equ    256*2+fon_widtab    ;start raw char position
  81. fon_raw        equ    256*4+fon_rawpos    ;start raw planes
  82.  
  83. lnd_sizx    equ    $4        ;size x
  84. lnd_sizy    equ    $8        ;size y
  85. lnd_palnum    equ    $10        ;aantal kleuren -1
  86. lnd_pal        equ    $12        ;palette
  87. lnd_wrl        equ    256*2+lnd_pal    ;worlddata
  88. var_len        equ    $300        ;lengte vartabel
  89.  
  90. var__GfxBase    equ    $000        ;graphics lib
  91. var_pic1    equ    $004        ;current picture
  92. var_anispd1    equ    $008        ;animspeed
  93. var_anitel1    equ    $00c        ;animcount
  94. var_cprbck    equ    $010        ;copperback
  95. var_bck        equ    $014        ;background
  96. var_pic2    equ    $018        ;current picture
  97. var_ntsc    equ    $01c        ;ntsc/pal frequence
  98. var_lnd        equ    $020        ;landscape
  99. var_anilop1    equ    $024
  100. var_rottrg    equ    $028        ;effect trigger
  101. var_txt1    equ    $040        ;text
  102. var_txt16    equ    15*4+var_txt1
  103. var_vec1    equ    $080        ;vectors
  104. var_vec16    equ    15*4+var_vec1
  105. var_fon1    equ    $0c0        ;fonts
  106. var_fon16    equ    15*4+var_fon1
  107. var_cols1    equ    $100        ;colorsets
  108. var_cols16    equ    15*4+var_cols1
  109. var_obj1    equ    $180        ;objects
  110. var_obj16    equ    15*4+var_obj1
  111.  
  112.     ifd    rout
  113.     ;videotracker routine-test
  114.  
  115.     incdir    "w:include/"
  116.     include    "exec/types.i"
  117.     include    "graphics/gfxbase.i"
  118.     include    "lvo/graphics_lib.i"
  119.     incdir    'videotracker:effect/'
  120.  
  121.     SECTION    1,CODE_C
  122. tus
  123.     lea    var,a0
  124.  
  125. ;    move.l    #rotincfon,var_fon1(a0)        ;incbinfile !!!
  126. ;    move.l    #rotincfon,4+var_fon1(a0)    ;incbinfile !!!
  127. ;    move.l    #rotinctxt,var_txt1(a0)        ;incbinfile !!!
  128.  
  129. ;    move.l    #rotincobj,var_obj1(a0)    ;incbinfile !!!
  130. ;    move.l    #rotincbck,var_bck(a0)    ;incbinfile !!!
  131. ;    move.l    #rottube,var_vec1(a0)    ;incbinfile !!!
  132. ;    move.l    #rotsrc,curpic1        ;picture !!!
  133. ;    move.l    #rotsrc,curpal1        ;palette !!!
  134. ;    move.l    #rotset,var_cols1(a0)    ;colorset !!!
  135.  
  136.     bsr    paltabres
  137.  
  138.     move.l    ($4).w,a6
  139.     sub.l    a1,a1
  140.     jsr    -$126(a6)        ;findtask
  141.     move.l    d0,curtsk
  142.     move.l    d0,a0
  143.     move.l    $b8(a0),tskpri
  144.  
  145.     lea    dosnam,a1        ;doslib openen
  146.     moveq.l    #0,d0
  147.     move.l    (4).w,a6
  148.     jsr    -408(a6)        ;openlib
  149.     move.l    d0,doslib
  150.  
  151.     bsr.s    label5            ;videotracker opstarten
  152.     
  153.     move.l    curtsk,a0
  154.     move.l    tskpri,$b8(a0)
  155.     move.l    ($4).w,a6
  156.     jsr    -$84(a6)        ;forbid
  157.  
  158.     move.l    doslib,a1
  159.     move.l    (4).w,a6
  160.     jsr    -414(a6)        ;closelib
  161.  
  162.     moveq.l    #0,d0
  163.     rts
  164.     
  165. label5
  166.     move.l    (4).w,a6        ;workbench gedoe
  167.  
  168.     move.b    530(a6),ntscmode    ;50/60 hertz halen
  169.  
  170.     ifd    ntsctest
  171.     move.b    #60,ntscmode        ;60 hertz (ntsc)
  172.     endc
  173.  
  174.     cmp.b    #50,ntscmode        ;ntsc ?
  175.     beq.s    str.ntsc
  176.     move.l    #vew_hgt-56,hogscr    ;set NTSC screen hight
  177. str.ntsc
  178.  
  179.     lea    cprjmp,a2        ;copjmp zetten !
  180.     move.l    #cprbck-8,d0
  181.     move.w    d0,6(a2)
  182.     swap    d0
  183.     move.w    d0,2(a2)
  184.  
  185.     lea    cprbck-8,a2        ;copstr zetten !
  186.     move.l    #cpr,d0
  187.     move.w    d0,6(a2)
  188.     swap    d0
  189.     move.w    d0,2(a2)
  190.  
  191.     bsr    cprsprrem        ;sprites legen
  192.  
  193.     lea    gfxnam,a1        ;graphics lib openen
  194.     move.l    (4).w,a6
  195.     jsr    -408(a6)        ;openlib
  196.     move.l    d0,a6
  197.     move.l    d0,gfxlib
  198.     move.l    38(a6),oldcprlist
  199.  
  200.     bset    #1,$bfe001
  201.     bsr    copbuf            ;copper vullen
  202.  
  203.     bsr    sysoff
  204.  
  205. gadrun
  206.     btst    #6,($bfe001).l
  207.     bne    gadrun
  208.  
  209. scrend
  210. scrend.play
  211.     bsr    syson
  212.  
  213.     move.l    gfxlib,a1
  214.     move.l    (4).w,a6
  215.     jsr    -414(a6)        ;closelib
  216.  
  217. scrend.qb
  218.     moveq.l    #0,d0    
  219.     rts
  220.     
  221.     ;vertical blank interrupt, no blits.
  222.     ;handles counters,interlace,sprite
  223.     ;level 3
  224.  
  225. intvb
  226.     bra.s    intvb.cnt
  227.     dc.l    'VIDU'
  228.     dc.l    'LOOP'
  229. intvb.cnt
  230.     movem.l    d0-d7/a0-a6,-(sp)
  231.     lea    ($dff000).l,a6
  232.  
  233.     move.w    $01e(a6),d0
  234.     btst    #5,d0            ;vblank ?
  235.     bne.s    intvb.vb
  236.  
  237.     bra.s    intcop.end
  238.  
  239. intvb.vb
  240.     bsr    grap
  241.     bsr    palctr            ;palette zetten
  242.     bsr.s    copbuf            ;copper vullen
  243.     
  244. intvb.end
  245.     move.w    #$0020,$09c(a6)    ;vb bit wissen
  246.     movem.l    (sp)+,d0-d7/a0-a6    ;multitask uit, shit !
  247.     rte
  248.  
  249. intcop.end
  250.     movem.l    (sp)+,d0-d7/a0-a6
  251.     move.l    intvbold,-(sp)
  252.     rts
  253.  
  254.     ;transmission buffer empty routine, BLIT !
  255.     ;handles routines,animations
  256.     
  257. inttbe                    ;tbe interrupt
  258.     movem.l    d0-d7/a0-a6,-(sp)
  259.     lea    ($dff000).l,a6
  260.  
  261.     move.w    $01e(a6),d0
  262.     btst    #0,d0            ;no tbe ?
  263.     beq.s    intdskblk
  264.  
  265.  
  266.     btst    #6,($bfe001).l        ;muis ingedrukt ?
  267.     beq.s    inttbe.cop
  268.     btst    #2,($dff016).l
  269.     beq.s    inttbe.cop
  270.  
  271.     ifd    debug
  272.     move.w    #$700,$dff180
  273.     endc
  274.     
  275.     bsr    rotply            ;routineplayer BLIT !
  276.     bsr.s    copbuf            ;copper vullen
  277.  
  278.     ifd    debug
  279.     move.w    #$070,$dff180
  280.     endc
  281.     
  282. inttbe.cop
  283.  
  284. inttbe.end
  285.     move.w    #$0001,$09c(a6)
  286.     movem.l    (sp)+,d0-d7/a0-a6
  287.     rte
  288.  
  289. intdskblk
  290.     move.w    #$0001,$09c(a6)        ;be sure for no tbe handling
  291.     movem.l    (sp)+,d0-d7/a0-a6
  292.     move.l    inttbeold,-(sp)
  293.     rts
  294.  
  295.  
  296.     ;moves the copperbuffer to the copperlist
  297.     ;sort of double buffering
  298.     
  299. copbuf
  300.     movem.l    d0-d7/a0-a6,-(sp)
  301.  
  302.     lea    ($dff000).l,a6
  303.  
  304. copbuf.novb                ;copperchange overslaan
  305.     moveq.l    #0,d0
  306.     move.b    $005(a6),d0
  307.     lsl.w    #8,d0
  308.     moveq.l    #0,d1
  309.     move.b    $006(a6),d1
  310.     add.w    d1,d0
  311.  
  312.     cmp.w    #$4,d0            ;lower limit, all stations 100%
  313.     blt    copbuf.novb
  314.  
  315.     cmp.b    #50,ntscmode
  316.     beq.s    copbuf.pal
  317.     cmp.w    #$133-72-8,d0        ;ntsc grens
  318.     bge    copbuf.novb
  319.     bra.s    copbuf.cont
  320. copbuf.pal
  321.     cmp.w    #$133-8,d0        ;pal grens
  322.     bge    copbuf.novb
  323. copbuf.cont
  324.  
  325.     lea    gra.s,a0        ;buffer copieren
  326.     lea    cprbuf,a1
  327. copbuf_aga                ;AGA stuff :)
  328.     move.l    #(gra.ql)/4-1,d0
  329. copbuf.a
  330.     move.w    2(a0),2(a1)
  331.     add.l    #4,a0
  332.     add.l    #4,a1
  333.     dbra    d0,copbuf.a
  334.  
  335. copbuf.end
  336.     movem.l    (sp)+,d0-d7/a0-a6
  337.     rts
  338.  
  339.     ;goes back to the workbench
  340.     
  341. syson
  342.     movem.l    d0-d7/a0-a6,-(sp)
  343.  
  344.     move.w    #$0001,$dff09a        ;tbeint uit
  345.     move.l    intvbold,($6c).w
  346.     move.l    inttbeold,($64).w
  347.  
  348.     move.l    4,a6
  349.     jsr    -138(a6)        ;permit
  350.  
  351.     move.l    gfxlib,a6
  352.     jsr    -462(a6)        ;disownblitter
  353.  
  354.     move.l    wbview,a1
  355.     move.l    gfxlib,a6
  356.     jsr    _LVOLoadView(a6)     ; Fix view
  357.     jsr    _LVOWaitTOF(a6)
  358.     jsr    _LVOWaitTOF(a6)         ; wait for LoadView()
  359.  
  360. syson.ras
  361.     cmp.b    #$c0,$dff006        ;prevent copperjump
  362.     bne    syson.ras
  363.  
  364.     move.l    gfxlib,a6
  365.     move.l    gb_copinit(a6),$dff080     ; Kick it into life
  366.  
  367.     movem.l    (sp)+,d0-d7/a0-a6
  368.     rts
  369.     
  370.     ;goes back to the gadgetscreen
  371.     
  372. sysoff
  373.     movem.l    d0-d7/a0-a6,-(sp)
  374.      
  375.     move.l    gfxlib,a6
  376.     move.l    gb_ActiView(a6),wbview    ;current view
  377.     sub.l    a1,a1            ; clear a1
  378.     jsr     _LVOLoadView(a6)     ; Flush View to nothing
  379.     jsr    _LVOWaitTOF(a6)     ; Wait once
  380.     jsr    _LVOWaitTOF(a6)     ; Wait again.
  381.  
  382.     move.l    gfxlib,a6
  383.     jsr    -456(a6)        ;ownblitter
  384.  
  385.     move.l    4,a6
  386.     jsr    -132(a6)